
#ifndef	MEMORY_CACHE_LINESH
#define	MEMORY_CACHE_LINESH


#include "lookaside.h"
#include "cache_line_listener.h"


namespace	memory
{

	class	cache_lines
	{
	public:

		enum
		{
			max_lookaside_cache_count = 512,
		};

		cache_lines();
		~cache_lines();

		bool			create( cache_line_listener* listener, size_t parallelism, size_t lookaside_count );
		void			destroy();

		SLIST_ENTRY*	pop( size_t line_idx, size_t las_idx );
		bool			push( size_t line_idx, size_t las_idx, SLIST_ENTRY* entry );

		size_t			line_count()	const;
		size_t			las_count()		const;

	private:

		lookaside*		at( size_t line_idx )	const;

		void			clear();

	private:

		cache_line_listener*	listener_;

		lookaside*				lookaside_;
		size_t					count_;

	};
}




#endif